/*
 * @Author: szx
 * @Date: 2022-03-17 12:09:54
 * @LastEditTime: 2022-03-17 12:18:29
 * @Description:
 * @FilePath: \leetcode\剑指offer\09\09.js
 */
var CQueue = function () {
    this.input = [];
    this.out = [];
};

/**
 * @param {number} value
 * @return {void}
 */
CQueue.prototype.appendTail = function (value) {
    this.input.push(value);
};

/**
 * @return {number}
 */
CQueue.prototype.deleteHead = function () {
    if (this.out.length) {
        return this.out.pop();
    }
    while (this.input.length) {
        this.out.push(this.input.pop());
    }
    return this.out.length == 0 ? -1 : this.out.pop();
};

/**
 * Your CQueue object will be instantiated and called as such:
 * var obj = new CQueue()
 * obj.appendTail(value)
 * var param_2 = obj.deleteHead()
 */
